package com.hksj.umm.controller;

import com.hksj.cbm.vo.RuleSceneVO;
import com.hksj.common.core.model.Rest;
import com.hksj.umm.query.UVCockpitQuery;
import com.hksj.umm.service.UVCockpitService;
import com.hksj.umm.vo.UVDeviceOverviewVO;
import com.hksj.umm.vo.UVLightingDurationVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author fjt
 * @data 2024/11/4 15:57
 * @describe  紫外线灯——驾驶舱
 */
@Api(tags = "紫外线灯——驾驶舱")
@RestController
@RequestMapping("/api/umm/cockpit")
public class UVCockpitController {


    @Autowired
    private UVCockpitService cockpitService;


    @GetMapping("/queryScheduledTasks/{ruleType}")
    @ApiOperation(value = "定时控制策略查询", notes = "定时控制策略查询，ruleType为规则策略类型(字典表中定义)",response = RuleSceneVO.class)
    public Rest<List<RuleSceneVO>> queryScheduledTasks(@PathVariable("ruleType") String ruleType){
        return Rest.ok(cockpitService.queryScheduledTasks(ruleType));
    }


    @PostMapping("/overView")
    @ApiOperation(value = "设备概览", notes = "设备概览",response = UVDeviceOverviewVO.class)
    public Rest<UVDeviceOverviewVO> deviceOverView(@RequestBody UVCockpitQuery query){
        return Rest.ok(cockpitService.deviceOverView(query));
    }


    @PostMapping("/LightingDurationDetail")
    @ApiOperation(value = "消杀记录（最近3天）", notes = "消杀记录（最近3天）",response = UVLightingDurationVO.class)
    public Rest<List<UVLightingDurationVO>> LightingDurationDetail(@RequestBody UVCockpitQuery query){
        return Rest.ok(cockpitService.LightingDurationDetail(query));
    }


    @PostMapping("/topTen")
    @ApiOperation(value = "各点位消杀时长统计排名(最近7天)", notes = "各点位消杀时长统计排名(最近7天)",response = UVLightingDurationVO.class)
    public Rest<List<UVLightingDurationVO>> LightingDurationTopTen(@RequestBody UVCockpitQuery query){
        return Rest.ok(cockpitService.LightingDurationTopTen(query));
    }


}
